﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace FITHOU_EDU_Server
{
    public partial class DemoLINQ : System.Web.UI.Page
    {
        static FITHOU_EDUDataContext db = new FITHOU_EDUDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            LinqFirst();
        }

        public void LinqFirst()
        {
            IEnumerable<tbl_Lichhoc> dsLichHoc = from p in db.tbl_Lichhocs
                                             where p.FK_sGiangvienID == "GV001"
                                             orderby p.dNgayhoc
                                             select p;
            String str = "<ul>";
            for (int i = 0; i < dsLichHoc.Count(); ++i)
            {
                tbl_Lichhoc tmp = dsLichHoc.ElementAt(i);
                str += "<li>" + tmp.dNgayhoc + "-" + tmp.sGiobatdau + "->" + tmp.sGioketthuc + "</li>";
            }
            str += "</ul>";
            lblLichHoc.Text = str;
        }


    }
}